package com.mall.user.domain.command;

import com.mall.user.domain.model.Gift;
import com.mall.user.domain.model.Goods;
import com.mall.user.domain.model.GoodsCommon;
import lombok.Data;

/**

 *
 * 赠品
 * 
 *
 * Created 2017/4/13 14:14
 */
@Data
public class GiftVo {
    /**
     * 赠品编号
     */
    private int giftId;
    /**
     * 商品SKU
     */
    private int goodsId;
    /**
     * 商品SPU
     */
    private int commonId;
    /**
     * 赠品数量
     */
    private int giftNum;
    /**
     * 赠品类型，1满优惠赠品、2商品赠品
     */
    private int giftType;
    /**
     * 项目编号，如满优惠编号、主商品编号
     */
    private int itemId;
    /**
     * 项目编号，记录商品赠品的主商品SPU
     */
    private Integer itemCommonId;
    /**
     * 商品名称
     */
    private String goodsName;
    /**
     * 计量单位
     */
    private String unitName;
    /**
     * 完整规格<br>
     * 例“颜色：红色；尺码：L”
     */
    private String goodsFullSpecs;
    /**
     * 图片路径
     */
    private String imageSrc="";

    public GiftVo() {
    }

    public GiftVo(Gift gift, Goods goods, GoodsCommon goodsCommon) {
        this.giftId = gift.getGiftId();
        this.goodsId = gift.getGoodsId();
        this.commonId = gift.getCommonId();
        this.giftNum = gift.getGiftNum();
        this.giftType = gift.getGiftType();
        this.itemId = gift.getItemId();
        this.itemCommonId = gift.getCommonId();
        this.goodsName = goodsCommon.getGoodsName().name();
        this.unitName = goodsCommon.getUnitName();
        this.goodsFullSpecs = goods.getGoodsFullSpecs();
        this.imageSrc = goods.getImageSrc();
    }
}
